<?php
namespace App\Models;

use App\admin\Service\OA;
use App\Jobs\Fun;

class LogModel extends Model
{
    const typeError=1;
    const typeinfo=2;
    protected $table = 'log';
    protected $fillable = [
        'id','content','time','ip','ua','uid'
    ];
    public static function add($text,$type=0,$classname=''){
        \App\admin\Service\OA::load();
        $new=new self;
        $new->content=$text;
        $new->time=time();
        $new->ip=Fun::Ip();
        $new->ua=Fun::UA();
        $new->type=$type;
        $new->classname=$classname;
        $new->uid=OA::$user->getId();
        $new->save();
    }
}